Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix createContext update being blocked by sCU #3889

Merged
merged 1 commit into from
Feb 9, 2023
Merged

Conversation

marvinhagemeister
Copy link
Member

@marvinhagemeister marvinhagemeister commented Feb 9, 2023

Came across a compatibility issue with React when it comes to how context updates are applied. When a class component subscribes to the new context API and has a shouldComponentUpdate, it must not call it when the update is triggered by context.

Before this PR we treated context update like a standard update. But the problem is that a falsy sCU could then cancel a context update.

This is the actual source of the problem discovered in preactjs/signals#302 where the sCU added for signal updates would block context updates.

Credits to @mdentremont for finding the key insights that lead to the discovery of the actual source of the bug for the signals issue.

@github-actions
Copy link

github-actions bot commented Feb 9, 2023

📊 Tachometer Benchmark Results

Summary

duration

  • 02_replace1k: unsure 🔍 -1% - +2% (-3.09ms - +5.13ms)
    preact-local vs preact-master
  • 03_update10th1k_x16: unsure 🔍 -4% - +2% (-1.72ms - +1.10ms)
    preact-local vs preact-master
  • 07_create10k: unsure 🔍 -1% - +0% (-11.31ms - +2.07ms)
    preact-local vs preact-master
  • filter_list: unsure 🔍 -2% - +2% (-0.66ms - +0.59ms)
    preact-local vs preact-master
  • hydrate1k: unsure 🔍 -4% - +1% (-5.40ms - +1.50ms)
    preact-local vs preact-master
  • many_updates: unsure 🔍 -3% - +3% (-1.27ms - +1.06ms)
    preact-local vs preact-master
  • text_update: unsure 🔍 -2% - +0% (-0.07ms - +0.00ms)
    preact-local vs preact-master
  • todo: unsure 🔍 -2% - +1% (-0.85ms - +0.48ms)
    preact-local vs preact-master

usedJSHeapSize

  • 02_replace1k: unsure 🔍 -0% - +0% (-0.01ms - +0.00ms)
    preact-local vs preact-master
  • 03_update10th1k_x16: unsure 🔍 -0% - +0% (-0.01ms - +0.00ms)
    preact-local vs preact-master
  • 07_create10k: unsure 🔍 -0% - +0% (-0.00ms - +0.00ms)
    preact-local vs preact-master
  • filter_list: unsure 🔍 -0% - +0% (-0.00ms - +0.00ms)
    preact-local vs preact-master
  • hydrate1k: unsure 🔍 -8% - +5% (-0.93ms - +0.62ms)
    preact-local vs preact-master
  • many_updates: faster ✔ 0% - 1% (0.01ms - 0.05ms)
    preact-local vs preact-master
  • text_update: unsure 🔍 -0% - +0% (-0.00ms - +0.00ms)
    preact-local vs preact-master
  • todo: unsure 🔍 -0% - +0% (-0.00ms - +0.00ms)
    preact-local vs preact-master

Results

02_replace1k

duration

VersionAvg timevs preact-mastervs preact-localvs preact-hooks
preact-master229.16ms - 235.45ms-unsure 🔍
-2% - +1%
-5.13ms - +3.09ms
unsure 🔍
-3% - +1%
-5.91ms - +1.95ms
preact-local230.67ms - 235.97msunsure 🔍
-1% - +2%
-3.09ms - +5.13ms
-unsure 🔍
-2% - +1%
-4.52ms - +2.59ms
preact-hooks231.92ms - 236.65msunsure 🔍
-1% - +3%
-1.95ms - +5.91ms
unsure 🔍
-1% - +2%
-2.59ms - +4.52ms
-

usedJSHeapSize

VersionAvg timevs preact-mastervs preact-localvs preact-hooks
preact-master3.37ms - 3.38ms-unsure 🔍
-0% - +0%
-0.00ms - +0.01ms
faster ✔
1% - 1%
0.02ms - 0.03ms
preact-local3.37ms - 3.38msunsure 🔍
-0% - +0%
-0.01ms - +0.00ms
-faster ✔
1% - 1%
0.02ms - 0.03ms
preact-hooks3.40ms - 3.41msslower ❌
1% - 1%
0.02ms - 0.03ms
slower ❌
1% - 1%
0.02ms - 0.03ms
-

run-warmup-0

VersionAvg timevs preact-mastervs preact-localvs preact-hooks
preact-master71.13ms - 75.11ms-unsure 🔍
-3% - +4%
-2.42ms - +3.16ms
unsure 🔍
-6% - +1%
-4.28ms - +0.93ms
preact-local70.79ms - 74.71msunsure 🔍
-4% - +3%
-3.16ms - +2.42ms
-unsure 🔍
-6% - +1%
-4.62ms - +0.53ms
preact-hooks73.12ms - 76.47msunsure 🔍
-1% - +6%
-0.93ms - +4.28ms
unsure 🔍
-1% - +6%
-0.53ms - +4.62ms
-

run-warmup-1

VersionAvg timevs preact-mastervs preact-localvs preact-hooks
preact-master97.93ms - 102.12ms-unsure 🔍
-5% - +1%
-4.66ms - +1.10ms
unsure 🔍
-6% - +0%
-6.02ms - +0.13ms
preact-local99.82ms - 103.78msunsure 🔍
-1% - +5%
-1.10ms - +4.66ms
-unsure 🔍
-4% - +2%
-4.16ms - +1.83ms
preact-hooks100.72ms - 105.22msunsure 🔍
-0% - +6%
-0.13ms - +6.02ms
unsure 🔍
-2% - +4%
-1.83ms - +4.16ms
-

run-warmup-2

VersionAvg timevs preact-mastervs preact-localvs preact-hooks
preact-master80.20ms - 85.49ms-unsure 🔍
-5% - +4%
-4.22ms - +3.35ms
slower ❌
2% - 11%
1.71ms - 8.18ms
preact-local80.57ms - 85.99msunsure 🔍
-4% - +5%
-3.35ms - +4.22ms
-slower ❌
3% - 11%
2.09ms - 8.67ms
preact-hooks76.03ms - 79.76msfaster ✔
2% - 10%
1.71ms - 8.18ms
faster ✔
3% - 10%
2.09ms - 8.67ms
-

run-warmup-3

VersionAvg timevs preact-mastervs preact-localvs preact-hooks
preact-master69.39ms - 72.37ms-unsure 🔍
-2% - +4%
-1.61ms - +2.74ms
faster ✔
4% - 9%
3.00ms - 6.77ms
preact-local68.73ms - 71.90msunsure 🔍
-4% - +2%
-2.74ms - +1.61ms
-faster ✔
5% - 10%
3.48ms - 7.40ms
preact-hooks74.61ms - 76.91msslower ❌
4% - 10%
3.00ms - 6.77ms
slower ❌
5% - 11%
3.48ms - 7.40ms
-

run-warmup-4

VersionAvg timevs preact-mastervs preact-localvs preact-hooks
preact-master72.87ms - 75.91ms-unsure 🔍
-3% - +3%
-2.15ms - +2.19ms
faster ✔
3% - 7%
2.00ms - 5.56ms
preact-local72.82ms - 75.92msunsure 🔍
-3% - +3%
-2.19ms - +2.15ms
-faster ✔
3% - 7%
2.00ms - 5.60ms
preact-hooks77.25ms - 79.10msslower ❌
3% - 8%
2.00ms - 5.56ms
slower ❌
3% - 8%
2.00ms - 5.60ms
-

run-final

VersionAvg timevs preact-mastervs preact-localvs preact-hooks
preact-master56.43ms - 58.82ms-unsure 🔍
-5% - +1%
-3.12ms - +0.52ms
unsure 🔍
-2% - +3%
-1.43ms - +1.84ms
preact-local57.55ms - 60.30msunsure 🔍
-1% - +5%
-0.52ms - +3.12ms
-unsure 🔍
-0% - +6%
-0.26ms - +3.28ms
preact-hooks56.30ms - 58.54msunsure 🔍
-3% - +2%
-1.84ms - +1.43ms
unsure 🔍
-6% - +0%
-3.28ms - +0.26ms
-
03_update10th1k_x16

duration

VersionAvg timevs preact-mastervs preact-localvs preact-hooks
preact-master42.95ms - 44.99ms-unsure 🔍
-3% - +4%
-1.10ms - +1.72ms
unsure 🔍
-3% - +3%
-1.47ms - +1.33ms
preact-local42.68ms - 44.64msunsure 🔍
-4% - +2%
-1.72ms - +1.10ms
-unsure 🔍
-4% - +2%
-1.75ms - +0.98ms
preact-hooks43.09ms - 45.00msunsure 🔍
-3% - +3%
-1.33ms - +1.47ms
unsure 🔍
-2% - +4%
-0.98ms - +1.75ms
-

usedJSHeapSize

VersionAvg timevs preact-mastervs preact-localvs preact-hooks
preact-master3.28ms - 3.29ms-unsure 🔍
-0% - +0%
-0.00ms - +0.01ms
faster ✔
0% - 1%
0.01ms - 0.02ms
preact-local3.28ms - 3.29msunsure 🔍
-0% - +0%
-0.01ms - +0.00ms
-faster ✔
0% - 1%
0.02ms - 0.02ms
preact-hooks3.30ms - 3.31msslower ❌
0% - 1%
0.01ms - 0.02ms
slower ❌
0% - 1%
0.02ms - 0.02ms
-
07_create10k

duration

VersionAvg timevs preact-mastervs preact-localvs preact-hooks
preact-master1367.27ms - 1378.05ms-unsure 🔍
-0% - +1%
-2.07ms - +11.31ms
unsure 🔍
-1% - +0%
-9.75ms - +3.28ms
preact-local1364.06ms - 1372.01msunsure 🔍
-1% - +0%
-11.31ms - +2.07ms
-faster ✔
0% - 1%
2.46ms - 13.26ms
preact-hooks1372.24ms - 1379.55msunsure 🔍
-0% - +1%
-3.28ms - +9.75ms
slower ❌
0% - 1%
2.46ms - 13.26ms
-

usedJSHeapSize

VersionAvg timevs preact-mastervs preact-localvs preact-hooks
preact-master25.36ms - 25.36ms-unsure 🔍
-0% - +0%
-0.00ms - +0.00ms
unsure 🔍
-0% - -0%
-0.02ms - -0.02ms
preact-local25.36ms - 25.36msunsure 🔍
-0% - +0%
-0.00ms - +0.00ms
-unsure 🔍
-0% - -0%
-0.02ms - -0.02ms
preact-hooks25.38ms - 25.38msunsure 🔍
+0% - +0%
+0.02ms - +0.02ms
unsure 🔍
+0% - +0%
+0.02ms - +0.02ms
-
filter_list

duration

VersionAvg timevs preact-mastervs preact-localvs preact-hooks
preact-master28.15ms - 28.88ms-unsure 🔍
-2% - +2%
-0.59ms - +0.66ms
unsure 🔍
-2% - +2%
-0.59ms - +0.61ms
preact-local27.98ms - 28.99msunsure 🔍
-2% - +2%
-0.66ms - +0.59ms
-unsure 🔍
-3% - +2%
-0.71ms - +0.67ms
preact-hooks28.03ms - 28.97msunsure 🔍
-2% - +2%
-0.61ms - +0.59ms
unsure 🔍
-2% - +3%
-0.67ms - +0.71ms
-

usedJSHeapSize

VersionAvg timevs preact-mastervs preact-localvs preact-hooks
preact-master1.59ms - 1.59ms-unsure 🔍
-0% - +0%
-0.00ms - +0.00ms
faster ✔
1% - 1%
0.02ms - 0.02ms
preact-local1.59ms - 1.59msunsure 🔍
-0% - +0%
-0.00ms - +0.00ms
-faster ✔
1% - 2%
0.02ms - 0.02ms
preact-hooks1.61ms - 1.61msslower ❌
1% - 1%
0.02ms - 0.02ms
slower ❌
1% - 2%
0.02ms - 0.02ms
-
hydrate1k

duration

VersionAvg timevs preact-mastervs preact-localvs preact-hooks
preact-master124.67ms - 129.41ms-unsure 🔍
-1% - +4%
-1.50ms - +5.40ms
unsure 🔍
-1% - +4%
-1.69ms - +4.83ms
preact-local122.58ms - 127.60msunsure 🔍
-4% - +1%
-5.40ms - +1.50ms
-unsure 🔍
-3% - +2%
-3.74ms - +2.99ms
preact-hooks123.23ms - 127.71msunsure 🔍
-4% - +1%
-4.83ms - +1.69ms
unsure 🔍
-2% - +3%
-2.99ms - +3.74ms
-

usedJSHeapSize

VersionAvg timevs preact-mastervs preact-localvs preact-hooks
preact-master10.95ms - 12.06ms-unsure 🔍
-6% - +8%
-0.62ms - +0.93ms
unsure 🔍
-9% - +3%
-1.13ms - +0.36ms
preact-local10.82ms - 11.89msunsure 🔍
-8% - +5%
-0.93ms - +0.62ms
-unsure 🔍
-11% - +2%
-1.27ms - +0.19ms
preact-hooks11.40ms - 12.39msunsure 🔍
-3% - +10%
-0.36ms - +1.13ms
unsure 🔍
-2% - +11%
-0.19ms - +1.27ms
-
many_updates

duration

VersionAvg timevs preact-mastervs preact-localvs preact-hooks
preact-master37.93ms - 39.67ms-unsure 🔍
-3% - +3%
-1.06ms - +1.27ms
unsure 🔍
-4% - +2%
-1.41ms - +0.83ms
preact-local37.92ms - 39.47msunsure 🔍
-3% - +3%
-1.27ms - +1.06ms
-unsure 🔍
-4% - +2%
-1.45ms - +0.65ms
preact-hooks38.38ms - 39.80msunsure 🔍
-2% - +4%
-0.83ms - +1.41ms
unsure 🔍
-2% - +4%
-0.65ms - +1.45ms
-

usedJSHeapSize

VersionAvg timevs preact-mastervs preact-localvs preact-hooks
preact-master4.63ms - 4.65ms-slower ❌
0% - 1%
0.01ms - 0.05ms
faster ✔
0% - 1%
0.02ms - 0.03ms
preact-local4.59ms - 4.63msfaster ✔
0% - 1%
0.01ms - 0.05ms
-faster ✔
1% - 2%
0.03ms - 0.07ms
preact-hooks4.66ms - 4.66msslower ❌
0% - 1%
0.02ms - 0.03ms
slower ❌
1% - 2%
0.03ms - 0.07ms
-
text_update

duration

VersionAvg timevs preact-mastervs preact-localvs preact-hooks
preact-master2.98ms - 3.04ms-unsure 🔍
-0% - +2%
-0.00ms - +0.07ms
faster ✔
3% - 5%
0.08ms - 0.17ms
preact-local2.95ms - 3.00msunsure 🔍
-2% - +0%
-0.07ms - +0.00ms
-faster ✔
4% - 6%
0.12ms - 0.20ms
preact-hooks3.11ms - 3.17msslower ❌
3% - 6%
0.08ms - 0.17ms
slower ❌
4% - 7%
0.12ms - 0.20ms
-

usedJSHeapSize

VersionAvg timevs preact-mastervs preact-localvs preact-hooks
preact-master0.82ms - 0.82ms-unsure 🔍
-0% - +0%
-0.00ms - +0.00ms
faster ✔
1% - 2%
0.01ms - 0.01ms
preact-local0.82ms - 0.82msunsure 🔍
-0% - +0%
-0.00ms - +0.00ms
-faster ✔
1% - 2%
0.01ms - 0.02ms
preact-hooks0.83ms - 0.83msslower ❌
1% - 2%
0.01ms - 0.01ms
slower ❌
1% - 2%
0.01ms - 0.02ms
-
todo

duration

VersionAvg timevs preact-mastervs preact-localvs preact-hooks
preact-master54.88ms - 55.83ms-unsure 🔍
-1% - +2%
-0.48ms - +0.85ms
unsure 🔍
-2% - +0%
-0.99ms - +0.16ms
preact-local54.71ms - 55.64msunsure 🔍
-2% - +1%
-0.85ms - +0.48ms
-faster ✔
0% - 2%
0.02ms - 1.17ms
preact-hooks55.44ms - 56.10msunsure 🔍
-0% - +2%
-0.16ms - +0.99ms
slower ❌
0% - 2%
0.02ms - 1.17ms
-

usedJSHeapSize

VersionAvg timevs preact-mastervs preact-localvs preact-hooks
preact-master1.09ms - 1.09ms-unsure 🔍
-0% - +0%
-0.00ms - +0.00ms
faster ✔
2% - 3%
0.02ms - 0.03ms
preact-local1.09ms - 1.09msunsure 🔍
-0% - +0%
-0.00ms - +0.00ms
-faster ✔
2% - 3%
0.03ms - 0.03ms
preact-hooks1.11ms - 1.12msslower ❌
2% - 3%
0.02ms - 0.03ms
slower ❌
2% - 3%
0.03ms - 0.03ms
-

tachometer-reporter-action v2 for Benchmarks

@coveralls
Copy link

coveralls commented Feb 9, 2023

Coverage Status

Coverage: 99.543% (+0.0007%) from 99.543% when pulling cea22e0 on context-scu into 9b83481 on master.

@github-actions
Copy link

github-actions bot commented Feb 9, 2023

Size Change: +37 B (0%)

Total Size: 54 kB

Filename Size Change
dist/preact.js 4.23 kB +7 B (0%)
dist/preact.min.js 4.26 kB +5 B (0%)
dist/preact.min.module.js 4.26 kB +6 B (0%)
dist/preact.min.umd.js 4.28 kB +6 B (0%)
dist/preact.module.js 4.25 kB +7 B (0%)
dist/preact.umd.js 4.31 kB +6 B (0%)
ℹ️ View Unchanged
Filename Size Change
compat/dist/compat.js 3.81 kB 0 B
compat/dist/compat.module.js 3.75 kB 0 B
compat/dist/compat.umd.js 3.87 kB 0 B
debug/dist/debug.js 3 kB 0 B
debug/dist/debug.module.js 3.01 kB 0 B
debug/dist/debug.umd.js 3.08 kB 0 B
devtools/dist/devtools.js 231 B 0 B
devtools/dist/devtools.module.js 240 B 0 B
devtools/dist/devtools.umd.js 314 B 0 B
hooks/dist/hooks.js 1.49 kB 0 B
hooks/dist/hooks.module.js 1.52 kB 0 B
hooks/dist/hooks.umd.js 1.57 kB 0 B
jsx-runtime/dist/jsxRuntime.js 360 B 0 B
jsx-runtime/dist/jsxRuntime.module.js 326 B 0 B
jsx-runtime/dist/jsxRuntime.umd.js 441 B 0 B
test-utils/dist/testUtils.js 442 B 0 B
test-utils/dist/testUtils.module.js 444 B 0 B
test-utils/dist/testUtils.umd.js 526 B 0 B

compressed-size-action

@marvinhagemeister marvinhagemeister merged commit 1de8059 into master Feb 9, 2023
@marvinhagemeister marvinhagemeister deleted the context-scu branch February 9, 2023 11:33
JoviDeCroock added a commit that referenced this pull request Jan 12, 2024
JoviDeCroock added a commit that referenced this pull request Jan 12, 2024
* backport #3871

* port test from #3884 functionality seems to work in v11

* backport #3880

* backport #3875

* backport #3862

* add todo for #3801

* backport #3868

* backport #3867

* backport #3863

* add todo for #3856

* backport #3844

* backport #3816

* backport #3888

* backport #3889
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants